import React from 'react';
import { CopyToClipboard } from 'react-copy-to-clipboard';
import Show from './show.jsx';
import MDXDocument from './code.mdx';
import { message } from 'antd';

export default class View extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            codeShow: false
        };
    }

    render() {
        return (
            <div className="demo_each_area">
                <Show />
                <div className="show_code_tools_line">
                    <div onClick={() => this.setState({ codeShow: !this.state.codeShow })} className="see_code_btn">源码</div>
                    <CopyToClipboard className="see_code_btn" text={"333"} onCopy={() => message.success('复制成功')}>
                        <span >复制</span>
                    </CopyToClipboard>
                </div>
                {this.state.codeShow ? <MDXDocument /> : null}
            </div>
        );
    }
}



